$(document).ready(function () {
    $("form").submit(function (e) {
        e.preventDefault(); 

        let email = $("#password").val(); 
        let password1 = $("#password1").val(); 
        let password2 = $("#password2").val(); 

        let emailError = $(".error-msg:eq(0)"); 
        let passwordError = $(".error-msg:eq(1)");

    
        passwordError.text("");
        
        let emailRegex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
        if (!emailRegex.test(email)) {
            emailError.text("请输入正确的邮箱格式");
            return;
        }


        if (password1!== password2) {
            passwordError.text("两次输入的密码不一致，请重新输入");
            return;
        }


        alert("校验通过，可进行提交操作");
    });
});